const rows = [
  {
    "id":"604f764971f93f3ac8f365c2",
    "mobile":"13800000002",
    "username":"管理员",
    "password":"e10adc3949ba59abbe56e057f20f883e",
    "timeOfEntry":"2018-11-02",
    "formOfEmployment":1,
    "workNumber":"9002",
    "correctionTime":"2018-11-30",
    "departmentName":"总裁办",
    "staffPhoto":"http://q6cu3t6jv.bkt.clouddn.com/1063705989926227968?t=1616204161907"
  },

  {"id":"604f764971f93f3ac8f365c3","mobile":"13800000003","username":"孙财","password":"e10adc3949ba59abbe56e057f20f883e","timeOfEntry":"2018-11-04","formOfEmployment":1,"workNumber":"111","correctionTime":"2018-11-20","departmentName":"市场部","staffPhoto":"http://q6cu3t6jv.bkt.clouddn.com/1063705989926227968?t=1616204161907"},{"id":"604f764971f93f3ac8f365c4","mobile":"13800000004","username":"罗晓晓","password":"e10adc3949ba59abbe56e057f20f883e","timeOfEntry":"2018-12-02","formOfEmployment":1,"workNumber":"1111","correctionTime":"2018-12-31","departmentName":"人事部","staffPhoto":"http://q6cu3t6jv.bkt.clouddn.com/1063705989926227968?t=1616204161907"},{"id":"604f764971f93f3ac8f365c5","mobile":"13400000001","username":"文吉星","password":"e10adc3949ba59abbe56e057f20f883e","timeOfEntry":"2018-01-01","formOfEmployment":1,"workNumber":"1001","correctionTime":"1970-01-01","departmentName":"人事部","staffPhoto":""},{"id":"604f764971f93f3ac8f365c6","mobile":"13400000002","username":"巴思慧","password":"e10adc3949ba59abbe56e057f20f883e","timeOfEntry":"2018-01-01","formOfEmployment":1,"workNumber":"1002","correctionTime":"1970-01-01","departmentName":"人事部","staffPhoto":""}]

function transData(rows) {
  const map = {
    'id': '编号',
    'password': '密码',
    'mobile': '手机号',
    'username': '姓名',
    'timeOfEntry': '入职日期',
    'formOfEmployment': '聘用形式',
    'correctionTime': '转正日期',
    'workNumber': '工号',
    'departmentName': '部门',
    'staffPhoto': '头像地址'
  }

  // 写代码
  // header => ['id', '手机号', '用户名', ... ]
  // data => [
  //   ["604f764971f93f3ac8f365c2", "13800000002", "管理员",.... ]
  //]
  const enKeys =  Object.keys(rows[0])
  const header = enKeys.map(enKey => {
    return map[enKey]
  })
  const data = rows.map(obj => {
    return Object.values(obj)
  })

  return { header, data }
}

const { header, data} = transData(rows)
console.log(header, data)